﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System
{
    public static class TypeExtension
    {
        public static void LogExceptions(this Task task, string title = "Task")
        {
            task.ContinueWith(t =>
            {
                var aggException = t.Exception.Flatten();
                Console.WriteLine(aggException);
            }, TaskContinuationOptions.OnlyOnFaulted);
        }

    }
}
